<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html >
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>添加学生信息1</title>
</head>
<body>
<form action="addStu" method="post">
    <center>
        <table >
            <tr>
                <td align="center" colspan="2">添加学生信息</td>
            </tr>
            <tr>
                <td>姓名:</td>
                <td><input type="text" id="name" onblur="checkNameValue()" name="name"></td>
            </tr>
            <tr>
                <td>性别:</td>
                <td>
                    <input type="radio" name="sex" value="M" checked="checked">男
                    <input type="radio" name="sex" value="F">女
                </td>
            </tr>
            <tr>
                <td>专业:</td>
                <td><input type="text" name="speciality"></td>
            </tr>
            <tr>
                <td>年级:</td>
                <td><select name="grade">
                    <option value="大一">大一</option>
                    <option value="大二">大二</option>
                    <option value="大三">大三</option>
                    <option value="大四">大四</option>
                </select></td>
            </tr>
            <tr>
                <td>入学:</td>
                <td><input type="text" name="startime" placeholder="格式:2018-09"></td>
            </tr>
            <tr>
                <td>毕业:</td>
                <td><input type="text" name="endtime" placeholder="格式:2018-06"></td>
            </tr>
            <tr>
                <td>状态:</td>
                <td>
                    <select name="stutype">
                        <option value="0">在校</option>
                        <option value="1">离校</option>
                        <option value="2">毕业</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td align="center" colspan="2"><input type="submit" value="添加"></td>
            </tr>
        </table>
    </center>
</form>
</body>
</html>
<script>
    function checkNameValue() {
        var name = document.getElementById("name")
        var nameValue = name.vaue
        if(name == ""){
            alert("姓名不能为空")
        }
    }

</script>